package com.bootdo.market.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.common.utils.R;
import com.bootdo.market.dao.CommonDao;
import com.bootdo.market.domain.*;
import com.bootdo.market.service.PlatformWhitelistDicService;
import com.bootdo.market.service.ThirdSdkAdvunionAdvpositionRelationshipService;
import com.bootdo.market.service.ThirdSdkAdvunionRelationshipService;
import com.bootdo.market.service.ThirdSdkConfigureService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 变现方SDK配置表
 *
 * @author jinse
 * @email market@jinse.com
 * @date 2019-04-29 14:24:56
 */

@Controller
@RequestMapping("/market/thirdSdkConfigure")
public class ThirdSdkConfigureController {
    @Autowired
    private ThirdSdkConfigureService thirdSdkConfigureService;
    @Autowired
    private CommonDao commonDao;
    @Autowired
    private ThirdSdkAdvunionRelationshipService thirdSdkAdvunionRelationshipService;
    @Autowired
    private ThirdSdkAdvunionAdvpositionRelationshipService thirdSdkAdvunionAdvpositionRelationshipService;
    @Autowired
    private PlatformWhitelistDicService platformWhitelistDicService;
    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping()
    @RequiresPermissions("market:thirdSdkConfigure:thirdSdkConfigure")
    String ThirdSdkConfigure(String thirdsdkid, String sdktype, Model model) {
        model.addAttribute("thirdsdkid", thirdsdkid);
        model.addAttribute("sdktype", sdktype);
        return "market/thirdSdkConfigure/thirdSdkConfigure";
    }

    @ResponseBody
    @GetMapping("/list")
    @RequiresPermissions("market:thirdSdkConfigure:thirdSdkConfigure")
    public PageUtils list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);
        List<ThirdSdkConfigureDO> thirdSdkConfigureList = thirdSdkConfigureService.list(query);
        int total = thirdSdkConfigureService.count(query);
        PageUtils pageUtils = new PageUtils(thirdSdkConfigureList, total);
        return pageUtils;
    }

    @GetMapping("/add")
    @RequiresPermissions("market:thirdSdkConfigure:add")
    String add(String thirdsdkid, Model model) {
        model.addAttribute("thirdsdkid", thirdsdkid);
        return "market/thirdSdkConfigure/add";
    }

    @GetMapping("/edit/{id}")
    @RequiresPermissions("market:thirdSdkConfigure:edit")
    String edit(@PathVariable("id") Integer id, Model model) {
        ThirdSdkConfigureDO thirdSdkConfigure = thirdSdkConfigureService.get(id);
        model.addAttribute("thirdSdkConfigure", thirdSdkConfigure);
        return "market/thirdSdkConfigure/edit";
    }

    /**
     * 保存
     */
    @ResponseBody
    @PostMapping("/save")
    @RequiresPermissions("market:thirdSdkConfigure:add")
    public R save(ThirdSdkConfigureDO thirdSdkConfigure) {
        if (thirdSdkConfigureService.save(thirdSdkConfigure) > 0) {
            Map<String, Object> params = new HashMap<>();
            params.put("thirdsdkid", thirdSdkConfigure.getThirdsdkid());
            List<ThirdSdkAdvunionAdvpositionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.findAdvpositionconfigList(params);
            if (thirdSdkAdvunionRelationshipList != null) {
                thirdSdkAdvunionRelationshipList.stream().forEach(thirdSdkAdvunionAdvpositionRelationshipDO -> {
                    thirdSdkAdvunionAdvpositionRelationshipDO.setIsshowbtn(thirdSdkConfigure.getIsshowbtn());
                    thirdSdkAdvunionAdvpositionRelationshipService.update(thirdSdkAdvunionAdvpositionRelationshipDO);
                });
            }
            return R.ok();
        }
        return R.error();
    }


    @RequestMapping(value = "/JudgingUniqueConfig", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public R JudgingUniqueConfig(HttpServletRequest request, ThirdSdkConfigureDO thirdSdkConfigure) {
        ThirdSdkConfigureDO aa = commonDao.JudgingUniqueConfig(thirdSdkConfigure.getThirdsdkid());
        if (aa == null) {
            return R.ok();
        } else {
            return R.error();
        }
    }

    /**
     * 修改
     */
    @ResponseBody
    @RequestMapping("/update")
    @RequiresPermissions("market:thirdSdkConfigure:edit")
    public R update(ThirdSdkConfigureDO thirdSdkConfigure) {
        thirdSdkConfigureService.update(thirdSdkConfigure);
        ThirdSdkConfigureDO thirdSdkConfigure1 = thirdSdkConfigureService.get(thirdSdkConfigure.getId());
        Map<String, Object> params = new HashMap<>();
        params.put("thirdsdkid", thirdSdkConfigure1.getThirdsdkid());
        List<ThirdSdkAdvunionAdvpositionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.findAdvpositionconfigList(params);
        if (thirdSdkAdvunionRelationshipList != null) {
            thirdSdkAdvunionRelationshipList.stream().forEach(thirdSdkAdvunionAdvpositionRelationshipDO -> {
                thirdSdkAdvunionAdvpositionRelationshipDO.setIsshowbtn(thirdSdkConfigure1.getIsshowbtn());
                thirdSdkAdvunionAdvpositionRelationshipService.update(thirdSdkAdvunionAdvpositionRelationshipDO);
            });
        }
        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/remove")
    @ResponseBody
    @RequiresPermissions("market:thirdSdkConfigure:remove")
    public R remove(Integer id) {
        if (thirdSdkConfigureService.remove(id) > 0) {
            return R.ok();
        }
        return R.error();
    }

    /**
     * 删除
     */
    @PostMapping("/batchRemove")
    @ResponseBody
    @RequiresPermissions("market:thirdSdkConfigure:batchRemove")
    public R remove(@RequestParam("ids[]") Integer[] ids) {
        thirdSdkConfigureService.batchRemove(ids);
        return R.ok();
    }

    @GetMapping("/adconfig")
    @RequiresPermissions("market:thirdSdkConfigure:adconfig")
    String adconfig(String thirdsdkid, Model model) {
        model.addAttribute("thirdsdkid", thirdsdkid);
        return "market/thirdSdkConfigure/configthirdSdkAdvunionRelationship";
    }

    @ResponseBody
    @RequestMapping(value = "/adconfigList", method = RequestMethod.POST)
    @RequiresPermissions("market:thirdSdkConfigure:adconfigList")
    public String adconfigList(@RequestParam Map<String, Object> params) {
        params.put("limit", params.get("rows"));
        params.put("offset", Integer.valueOf(params.get("page").toString()) - 1);
        //查询列表数据
        Query query = new Query(params);
        List<ThirdSdkAdvunionRelationshipDO> thirdSdkAdvunionRelationshipList = thirdSdkAdvunionRelationshipService.list(query);
        int total = thirdSdkAdvunionRelationshipService.count(query);
        String str = "{" + "\"total\": " + total + "," + "\"rows\": ";
        str += JSONArray.toJSONString(thirdSdkAdvunionRelationshipList) + "}";
        return str;
    }

    @RequestMapping(value = "/saveAdconfigList", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String saveAdconfigList(@RequestParam(value = "updated1", defaultValue = "", required = true) String updated,
                                   @RequestParam Map<String, Object> map, HttpServletRequest request) {
        List<ThirdSdkAdvunionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.saveAdconfigListAverage(map);
        List<Map<String, Object>> listUpdated = new ArrayList<Map<String, Object>>();
        Map<String, String> errormap = new HashMap<String, String>();
        if (!"".equals(updated)) {
            //把json字符串转换成对象
            net.sf.json.JSONArray jsonArr1 = net.sf.json.JSONArray.fromObject(updated);
            for (int i = 0; i < jsonArr1.size(); i++) {
                Map<String, Object> map2 = JSON.parseObject(jsonArr1.getString(i), Map.class);
                listUpdated.add(map2);
            }
        }
        int sum = 0;
        for (int i = 0; i < listUpdated.size(); i++) {
            sum += Integer.valueOf(listUpdated.get(i).get("advshowrate").toString());
        }
        List<ThirdSdkAdvunionRelationshipDO> list = thirdSdkAdvunionRelationshipList.stream().filter(thirdSdkAdvunionRelationshipDO ->
                listUpdated.stream().filter(stringObjectMap ->
                        thirdSdkAdvunionRelationshipDO.getId().toString().equalsIgnoreCase(stringObjectMap.get("id").toString())
                ).count() == 0).collect(Collectors.toList());
        for (int i = 0; i < list.size(); i++) {
            sum += list.get(i).getAdvshowrate();
        }
        if (sum != 100) {
            errormap.put("errormsg", "errorsum");
            return JSON.toJSONString(errormap);
        }
        for (int i = 0; i < listUpdated.size(); i++) {
            ThirdSdkAdvunionRelationshipDO thirdSdkAdvunionRelationship = new ThirdSdkAdvunionRelationshipDO();
            thirdSdkAdvunionRelationship.setId(Integer.valueOf(listUpdated.get(i).get("id").toString()));
            thirdSdkAdvunionRelationship.setAdvshowrate(Integer.valueOf(listUpdated.get(i).get("advshowrate").toString()));
            thirdSdkAdvunionRelationshipService.update(thirdSdkAdvunionRelationship);
        }
        errormap.put("errormsg", "true");
        return JSON.toJSONString(errormap);
    }

    @RequestMapping(value = "/saveAdconfigListAverage", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String saveAdconfigListAverage(@RequestParam Map<String, Object> params) {
        List<ThirdSdkAdvunionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.saveAdconfigListAverage(params);
        Map<String, String> errormap = new HashMap<String, String>();
        if (thirdSdkAdvunionRelationshipList == null) {
            errormap.put("errormsg", "false");
            return JSON.toJSONString(errormap);
        }
        int i = 100 / thirdSdkAdvunionRelationshipList.size();
        thirdSdkAdvunionRelationshipList.stream().forEach(thirdSdkAdvunionRelationshipDO -> {
            thirdSdkAdvunionRelationshipDO.setAdvshowrate(i);
            thirdSdkAdvunionRelationshipService.update(thirdSdkAdvunionRelationshipDO);
        });
        errormap.put("errormsg", "true");
        return JSON.toJSONString(errormap);
    }

    @RequestMapping(value = "/allAdvunionidList", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String allAdvunionidList(HttpServletRequest request) {
        List<PlatformAdvunionDO> platformAdvunionList = commonDao.allAdvunionidList();
        List<Map> list = new ArrayList<>();
        for (PlatformAdvunionDO model : platformAdvunionList) {
            Map map = new HashMap();
            map.put("db_name", model.getAdvunionname());
            map.put("id", model.getId());
            list.add(map);
        }
        System.out.println("------------->" + net.sf.json.JSONArray.fromObject(list).toString());
        return JSON.toJSONString(list);
    }

    @RequestMapping(value = "/advunionidAccountList", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String advunionidAccountList(@RequestParam Map<String, Object> params, HttpServletRequest request) {
        List<PlatformAdvunionAccountDO> platformAdvunionList = commonDao.advunionidAccountList(params);
        List<Map> list = new ArrayList<>();
        for (PlatformAdvunionAccountDO model : platformAdvunionList) {
            Map map = new HashMap();
            map.put("name", model.getUnionaccount());
            map.put("value", model.getId());
            list.add(map);
        }
        return JSON.toJSONString(list);
    }

    @GetMapping("/advpositionconfig")
    @RequiresPermissions("market:thirdSdkConfigure:advpositionconfig")
    String advpositionconfig(String thirdsdkid, Model model) {
        model.addAttribute("thirdsdkid", thirdsdkid);
        return "market/thirdSdkConfigure/configthirdSdkAdvunionAdvposition";
    }

    @ResponseBody
    @RequestMapping(value = "/advpositionconfigList", method = RequestMethod.POST)
    @RequiresPermissions("market:thirdSdkConfigure:adconfigList")
    public String advpositionconfigList(@RequestParam Map<String, Object> params) {
        params.put("limit", params.get("rows"));
        params.put("offset", Integer.valueOf(params.get("page").toString()) - 1);
        //查询列表数据
        Query query = new Query(params);
        List<ThirdSdkAdvunionAdvpositionRelationshipDO> thirdSdkAdvunionAdvpositionRelationshipList = thirdSdkAdvunionAdvpositionRelationshipService.list(query);
        int total = thirdSdkAdvunionAdvpositionRelationshipService.count(query);
        String str = "{" + "\"total\": " + total + "," + "\"rows\": ";
        str += JSONArray.toJSONString(thirdSdkAdvunionAdvpositionRelationshipList) + "}";
        return str;
    }

    @RequestMapping(value = "/showWhether", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String showWhether(@RequestParam Map<String, Object> params, HttpServletRequest request) {
        List<Map> list = new ArrayList<>();
        Map map = new HashMap();
        map.put("name", "不展示");
        map.put("value", "0");
        list.add(map);
        Map map1 = new HashMap();
        map1.put("name", "展示");
        map1.put("value", "1");
        list.add(map1);
        return JSON.toJSONString(list);
    }

    @RequestMapping(value = "/saveAdvpositionconfigList", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String saveAdvpositionconfigList(@RequestParam(value = "updated1", defaultValue = "", required = true) String updated,
                                            @RequestParam Map<String, Object> map, HttpServletRequest request) {
        List<ThirdSdkAdvunionAdvpositionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.findAdvpositionconfigList(map);
        List<Map<String, Object>> listUpdated = new ArrayList<Map<String, Object>>();
        Map<String, String> errormap = new HashMap<String, String>();
        if (!"".equals(updated)) {
            //把json字符串转换成对象
            net.sf.json.JSONArray jsonArr1 = net.sf.json.JSONArray.fromObject(updated);
            for (int i = 0; i < jsonArr1.size(); i++) {
                Map<String, Object> map2 = JSON.parseObject(jsonArr1.getString(i), Map.class);
                listUpdated.add(map2);
            }
        }
        int sum = 0;
        for (int i = 0; i < listUpdated.size(); i++) {
            sum += Integer.valueOf(listUpdated.get(i).get("advshownum").toString());
        }
        List<ThirdSdkAdvunionAdvpositionRelationshipDO> list = thirdSdkAdvunionRelationshipList.stream().filter(thirdSdkAdvunionRelationshipDO ->
                listUpdated.stream().filter(stringObjectMap ->
                        thirdSdkAdvunionRelationshipDO.getId().toString().equalsIgnoreCase(stringObjectMap.get("id").toString())
                ).count() == 0).collect(Collectors.toList());
        for (int i = 0; i < list.size(); i++) {
            sum += list.get(i).getAdvshownum();
        }
        if (sum != 100) {
            errormap.put("errormsg", "errorsum");
            return JSON.toJSONString(errormap);
        }
        for (int i = 0; i < listUpdated.size(); i++) {
            ThirdSdkAdvunionAdvpositionRelationshipDO thirdSdkAdvunionRelationship = new ThirdSdkAdvunionAdvpositionRelationshipDO();
            thirdSdkAdvunionRelationship.setId(Integer.valueOf(listUpdated.get(i).get("id").toString()));
            thirdSdkAdvunionRelationship.setAdvshownum(Integer.valueOf(listUpdated.get(i).get("advshownum").toString()));
            thirdSdkAdvunionRelationship.setIsshowbtn(Integer.valueOf(listUpdated.get(i).get("isshowbtn").toString()));
            thirdSdkAdvunionAdvpositionRelationshipService.update(thirdSdkAdvunionRelationship);
        }
        errormap.put("errormsg", "true");
        return JSON.toJSONString(errormap);
    }

    @RequestMapping(value = "/saveAdvpositionconfigtAverage", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String saveAdvpositionconfigtAverage(@RequestParam Map<String, Object> params) {
        List<ThirdSdkAdvunionAdvpositionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.findAdvpositionconfigList(params);
        Map<String, String> errormap = new HashMap<String, String>();
        if (thirdSdkAdvunionRelationshipList == null) {
            errormap.put("errormsg", "false");
            return JSON.toJSONString(errormap);
        }
        int i = 100 / thirdSdkAdvunionRelationshipList.size();
        thirdSdkAdvunionRelationshipList.stream().forEach(thirdSdkAdvunionRelationshipDO -> {
            thirdSdkAdvunionRelationshipDO.setAdvshownum(i);
            thirdSdkAdvunionAdvpositionRelationshipService.update(thirdSdkAdvunionRelationshipDO);
        });
        errormap.put("errormsg", "true");
        return JSON.toJSONString(errormap);
    }

    @RequestMapping(value = "/showAdvpositionconfig", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String showAdvpositionconfig(@RequestParam Map<String, Object> params) {
        List<ThirdSdkAdvunionAdvpositionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.findAdvpositionconfigList(params);
        Map<String, String> errormap = new HashMap<String, String>();
        if (thirdSdkAdvunionRelationshipList == null) {
            errormap.put("errormsg", "false");
            return JSON.toJSONString(errormap);
        }
        thirdSdkAdvunionRelationshipList.stream().forEach(thirdSdkAdvunionRelationshipDO -> {
            thirdSdkAdvunionRelationshipDO.setIsshowbtn(1);
            thirdSdkAdvunionAdvpositionRelationshipService.update(thirdSdkAdvunionRelationshipDO);
        });
        errormap.put("errormsg", "true");
        return JSON.toJSONString(errormap);
    }

    @RequestMapping(value = "/noshowAdvpositionconfig", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    @ResponseBody
    public String noshowAdvpositionconfig(@RequestParam Map<String, Object> params) {
        List<ThirdSdkAdvunionAdvpositionRelationshipDO> thirdSdkAdvunionRelationshipList = commonDao.findAdvpositionconfigList(params);
        Map<String, String> errormap = new HashMap<String, String>();
        if (thirdSdkAdvunionRelationshipList == null) {
            errormap.put("errormsg", "false");
            return JSON.toJSONString(errormap);
        }
        thirdSdkAdvunionRelationshipList.stream().forEach(thirdSdkAdvunionRelationshipDO -> {
            thirdSdkAdvunionRelationshipDO.setIsshowbtn(0);
            thirdSdkAdvunionAdvpositionRelationshipService.update(thirdSdkAdvunionRelationshipDO);
        });
        errormap.put("errormsg", "true");
        return JSON.toJSONString(errormap);
    }

    @GetMapping("/editWhitelist")
    @RequiresPermissions("market:thirdSdkConfigure:editWhitelist")
    String editWhitelist(String thirdsdkid, String sdktype, Model model) {
        model.addAttribute("thirdsdkid", thirdsdkid);
        model.addAttribute("sdktype", sdktype);
        return "market/thirdSdkConfigure/thirdWhitelistDic";
    }

    @ResponseBody
    @GetMapping("/editWhitelistlist")
    @RequiresPermissions("market:thirdSdkConfigure:editWhitelistlist")
    public PageUtils editWhitelistlist(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);
        List<PlatformWhitelistDicDO> platformWhitelistDicList = platformWhitelistDicService.list(query);
        int total = platformWhitelistDicService.count(query);
        PageUtils pageUtils = new PageUtils(platformWhitelistDicList, total);
        return pageUtils;
    }

    /**
     * 添加白名单
     */
    @PostMapping("/batchWhitelist")
    @ResponseBody
    @RequiresPermissions("market:thirdSdkConfigure:batchWhitelist")
    public R batchWhitelist(@RequestParam("ids[]") Integer[] ids, @RequestParam("thids[]") Integer[] thids, @RequestParam("thirdsdkid") String thirdsdkid) {
        for (int i = 0; i < thids.length; i++) {
            if (thids[i] != null && thids[i] == 0) {
                Map<String, Object> map = new HashMap<>();
                map.put("id", ids[i]);
                map.put("thirdsdkid", thirdsdkid);
                commonDao.insertWhitelist(map);
            }
        }
        return R.ok();
    }

    /**
     * 删除白名单
     */
    @PostMapping("/batchRemoveWhitelist")
    @ResponseBody
    @RequiresPermissions("market:thirdSdkConfigure:batchRemoveWhitelist")
    public R batchRemoveWhitelist(@RequestParam("ids[]") Integer[] ids, @RequestParam("thids[]") Integer[] thids, @RequestParam("thirdsdkid") String thirdsdkid) {
        for (int i = 0; i < thids.length; i++) {
            if (thids[i] != null && thids[i] != 0) {
                commonDao.deleteWhitelist(thids[i]);
            }
        }
        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/saveSdkConfigure")
    @ResponseBody
    @RequiresPermissions("market:thirdSdkConfigure:saveSdkConfigure")
    public R saveSdkConfigure(@RequestParam Map<String, Object> params) {
        Map<String, Object> configmap = new HashMap<>();
        Map<String, Object> map = commonDao.findThirdConfig(params);
        if ("true".equalsIgnoreCase(map.get("isOperate").toString())) {
            configmap.put("sdkEnable", true);
        } else {
            configmap.put("sdkEnable", false);
        }
        configmap.put("isShowClose", map.get("isShowBtn"));
        configmap.put("timeInterval", map.get("advShowInterval"));
        List<String> mapList = commonDao.findpackNameConfig(params);
        configmap.put("appInfos", mapList);

        List<Map<String, Object>> mapList11 = commonDao.findThirdadvunionRelationshipConfig(params);
        List<Map<String, Object>> mapList333 = new ArrayList<>();
        if (mapList11 != null) {
            mapList11.stream().forEach(stringObjectMap -> {
                        Map<String, Object> smallmap = new HashMap<>();
                        smallmap.put("advUnionType", stringObjectMap.get("advUnionType"));
                        smallmap.put("appId", stringObjectMap.get("unionAppId"));
                        smallmap.put("accountId", stringObjectMap.get("unionAccountId"));
                        smallmap.put("percentOfSelf", stringObjectMap.get("advShowRate"));
                        if ("true".equalsIgnoreCase(stringObjectMap.get("isLock").toString())) {
                            smallmap.put("enable", true);
                        } else {
                            smallmap.put("enable", false);
                        }
                        smallmap.put("showCount", map.get("advShowNum"));
                        List<Map<String, Object>> mapList22 = commonDao.findThirdthirdAdvpositionRelationshipConfig(stringObjectMap.get("id").toString());
                        smallmap.put("advPosition", mapList22);
                        mapList333.add(smallmap);
                    }
            );
        }
        configmap.put("sdkCtrl", mapList333);
        redisTemplate.opsForValue().set("config_" + params.get("thirdsdkid").toString(), JSONObject.toJSON(configmap).toString());
        String aa = redisTemplate.opsForValue().get("config_" + params.get("thirdsdkid").toString()).toString();
        String aaaa = JSONObject.toJSON(aa).toString();
        System.out.println(aaaa);
        /*//查询内置的list
        params.put("sdktype", 0);
        params.put("isoperate", 1);
        List<Map<String, Object>> neizhiList = aacommonService.findNeizhi(params);
        //查询热更的运营的list
        params.put("sdktype", 1);
        params.put("isoperate", 1);
        List<Map<String, Object>> regengNormalList = aacommonService.findRegengNormal(params);
        for (Map<String, Object> stringObjectMap : regengNormalList) {
            stringObjectMap.forEach((key, value) -> {
                if ("fu".equalsIgnoreCase(key)) {
                    value = domainname + "/" + value;
                    stringObjectMap.put(key, value);
                }
            });
        }
        //查询热能的删除的list
        params.put("isoperate", 0);
        List<Map<String, Object>> regengDeleteList = aacommonService.findRegengDelete(params);
//        sdkService.batchRemove(ids);
        Map<String, Object> mapData = new HashMap<>();
        mapData.put("n", neizhiList);
        Map<String, Object> regengMap = new HashMap<>();
        regengMap.put("a", regengNormalList);
        regengMap.put("d", regengDeleteList);
        mapData.put("r", regengMap);
        aacommonService.saveRedis(params, mapData);*/
        return R.ok();
    }

}
